<core:SET width='200'>
<core:SET title="Tell us your opinion">
<core:WRAP file="pub/layout.html" placeholder="Content">


<td class="mini" width="100%" valign="top" align="left" >



<form id="FeedbackForm" name="FeedbackForm" method="post" action="" runat="server">
<h1 align="center">Feedback Form {$title}  </h1>
<h2 align="center"> {$description} </h2>
<input name="form_id" type="hidden" id="form_id" runat="server">

<hr>
<core:optional for="msg">
	<span class="message" runat="server"> {$msg} </span>
</core:optional>
<hr>
<table width="100%" border="0" align="center" cellspacing="2" cellpadding="3">
    <tr align="left">
    	<td class="whiteheader_center">
    		<core:optional for="form_id">
    			{$title}
            </core:optional>
         </td>
         <td class="whiteheader">
         </td>
     </tr>

    <core:default for="supress_errors">
    <ERRORSUMMARY id='Summary' runat="server">
        <tr valign="top">
          <td width="{width}">Errors: &nbsp;</td>
          <td class="left">
          	<FONT COLOR="RED">
          		<list:ITEM> {$ErrorMessage} &nbsp; </list:ITEM>
          	</FONT>
          </td>
        </tr>
     </ERRORSUMMARY>
     </core:default>

     <tr>
     	<td class="small" colspan="2">
     	</td>
     </tr>

     <core:optional for="article_headline">
     <tr valign="top">
         <td class="form_label" width="{$width}">
      	 	<label for="article_headline" runat="server">Article:</label>
         </td>
         <td class="form_field">
         	{$article_headline}
         </td>
     </tr>
     </core:optional>

     <core:optional for="username">
     <tr valign="top">
         <td class="form_label" width="{$width}">
      	 	<label for="username" runat="server">User:</label>
         </td>
         <td class="form_field">
         	{$username}
         </td>
     </tr>
     </core:optional>

     <list:LIST id='List'>
     <list:ITEM>



     <core:literal>
     <?php
        // my code started
     	$row = &$root->children['FeedbackForm']->children['List']->_datasource;
     	$field_id = $row->get('field_id');
        $name = $row->get('name');
        $title = $row->get('title');
        $options = $row->get('options');
        $options_array = $row->get('options_array');
        if (!isset($options_array)) $options_array=array();
        $type = $row->get('type');
     	//print $field_id.','.$name.','.$title.','.$options.','.$type;

     ?>
     </core:literal>

     <tr valign="top">
         <td class="form_label" width="{$width}">
      	 	<label for="name" runat="server">{$title}</label>
         </td>
         <td class="form_field">

             <core:literal>
             	<?php
             		if ($type == 0) { // text single
                ?>
                	<input name="<?=$name?>^<?=$field_id?>" type="text" id="<?=$field_id?>"  runat="server"/>
                <?php
             		}
             	?>

                <?php
             		if ($type == 1) { // text multiple
                ?>
                    <textarea name='<?=$name?>^<?=$field_id?>' id='<?=$field_id?>' cols="60" rows="4" runat="server">
	 	 			</textarea>
                <?php
             		}
             	?>

                <?php
             		if ($type == 3) { // select single
                ?>
                    <select name='<?=$name?>^<?=$field_id?>' id='<?=$field_id?>' runat="server">
                    <?php
                    // populate options
                    foreach($options_array as $value) {
                    ?>
                    <option value="<?=$value?>"> <?=$value?> </option>
                    <?php
                    }
                    ?>
	 	 			</select>
                <?php
             		}
             	?>

                <?php
             		if ($type == 4) { // select multiple
                ?>
                    <select name='<?=$name?>^<?=$field_id?>[]' id='<?=$field_id?>' multiple runat="server">
                    <?php
                    // populate options
                    foreach($options_array as $value) {
                    ?>
                    <option value="<?=$value?>"> <?=$value?> </option>
                    <?php
                    }
                    ?>
	 	 			</select>
                <?php
             		}
             	?>

                <?php
             		if ($type == 5) { // radio button
                ?>
                    <input name="<?=$name?>^<?=$field_id?>" type="radio" id="<?=$field_id?>"  value="<?=$title?>" runat="server"/>
                <?php
             		}
             	?>

                <?php
             		if ($type == 2) { // checkbox button
                ?>
                    <input name="<?=$name?>^<?=$field_id?>" type="checkbox" id="<?=$field_id?>"  value="<?=$title?>" runat="server"/>
                <?php
             		}
             	?>

                <?php
             		if ($type == 6) { // checkbox group
                ?>

                	<?php
                    // populate options
                    foreach($options_array as $option_value) {
                    ?>
                    	<input name="<?=$name?>^<?=$field_id?>[]" type="checkbox" id="<?=$field_id?>"  value="<?=$option_value?>" runat="server"/> <?=$option_value?> &nbsp;
                    <?php
                    }
                    ?>
                <?php
             		}
             	?>

                <?php
             		if ($type == 7) { // radiobuttons group
                ?>

                	<?php
                    // populate options
                    foreach($options_array as $option_value) {
                    ?>
                    	<input name="<?=$name?>^<?=$field_id?>" type="radio" id="<?=$field_id?>"  value="<?=$option_value?>" runat="server"/> <?=$option_value?> &nbsp;
                    <?php
                    }
                    ?>
                <?php
             		}
             	?>

             </core:literal>


       </td>
     </tr>



     </list:ITEM>
     </list:LIST>

     <tr>
      <td class="whiteheader_center" colspan="2">
      </td>
     </tr>

	 <tr>
      <td>&nbsp;</td>
      <td class="form_field">
		<input type="submit" name="submit" value="Submit" runat="server">
		<input type="submit" name="clean" value="Clean" runat="server">
      </td>
	 </tr>

</table>
</form>

</td>